package porotos;

import java.util.logging.Logger;

import javax.enterprise.inject.Produces;
import javax.enterprise.inject.spi.InjectionPoint;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 * CDI recommends using "resource producers" to alias resources to CDI beans,
 * allowing for a consistent style throughout our application.
 * 
 * @author ggpollit
 * 
 */
public class Resources {

	@PersistenceContext
	@Produces
	public EntityManager entityManager;

	@Produces
	public Logger getLogger(InjectionPoint ip) {
		String category = ip.getMember().getDeclaringClass().getName();
		return Logger.getLogger(category);
	}
}
